import {
  NavigationGuardNext,
  RouteLocationNormalized,
  RouteRecordRaw,
  createRouter,
  createWebHistory,
} from "vue-router";

// 配置页面路由
const routes: Array<RouteRecordRaw> = [
  {
       path:"/",
       name:"index",
      // 默认定向到 /newpage
      redirect:"/login",
      children:[{
        // 增加一个路由
        path:"/login",
        name:"login",
        // 指向页面
        component: () => import("@/views/login/index.vue"),
      },{
        // 增加一个路由
        path:"/quotes",
        name:"quotes",
        // 指向页面
        component: () => import("@/views/quotes/index.vue"),
      }]
  }
];
const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});
router.beforeEach(
  (
    to: RouteLocationNormalized,
    from: RouteLocationNormalized,
    next: NavigationGuardNext
  ) => {
    next();
  }
);
export default router;